package com.ehsy.statement;

import com.dtflys.forest.http.ForestRequest;
import com.dtflys.forest.http.ForestResponse;
import com.ehsy.common.ResponseVo;
import com.ehsy.model.UserInfo;
import com.ehsy.service.HttpsTestService;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

import javax.annotation.Resource;

/**
 * @author YanZhen_Li
 * @version 1.0
 * @title A18Https处理
 * @description
 * @create 2024/6/19 13:46
 */
@SpringBootTest
        (webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
                properties = {"spring.config.location=classpath:https.yml"})
public class A18Https处理 {
    @Resource
    HttpsTestService service;
    /**
     * 简单的请求
     */
    @Test
    public void test1() {
        // ! 我们的配置可以使用全局的ssl配置也可以使用自己的ssl配置，配置的只有两个，分别是SSL和TSL
        // ! 我听说SSL好像有重大漏洞不用了，所有后面都是用的TSL
        UserInfo user = new UserInfo("张三", "18", "男", "上海", "13812341234", "123@qq.com", "123456");
        ResponseVo<UserInfo> test1 = service.test1(user);
        System.out.println(test1);
    }

    /**
     * ? 双向认证 未验证
     */
    @Test
    public void test2() {
        ForestResponse<String> response = service.test2();
        System.out.println(response);
    }
    /**
     * ? 自定义SSLSocketFactory 未验证
     */
    @Test
    public void test3() {
        ForestRequest<String> request = service.test3();
        System.out.println(request);
    }

    /**
     * ? 自定义HostnameVerifier 未验证
     */
    @Test
    public void test4() {
        ForestRequest<String> request = service.test4();
        System.out.println(request);
    }
}
